{extend name="/base/index"}
{block name="title"}
<title>提现</title>
{/block}
<!--首部 -- 出金-->
{block name="header_withdraw"}
				<a class="ground-item active" href="/withdrawal/apply.html" style="text-decoration:none;">出金</a>
{/block}
<!--左侧边--出金-->
{block name="left_bar_apply"}
							<li class="submeun-4"><i class="ioc active" style="top: 12px;"></i>
								<a class="l-m-icon active" href="/index.php/withdrawal/apply.html">出金</a>
								<span class="active"></span>
							</li>
{/block}
<!--右侧显示内容--顶部-->
{block name="right_bar_box_top"}
					<input type="hidden" id="ACTIVE_MENU" value="submeun-1" autocomplete="off">
					<div class="crumbs">
						<div class="container"> 管理系统&nbsp;&gt;&nbsp;个人中心&nbsp;&gt;&nbsp;出金 </div>
					</div>
{/block}
<!--右侧显示内容结束-->
{block name="right_bar_box"}
<div class="dlmain Myhomepage">
	<div class="homeright pageright f_r">
		<div>
			<div class="page_title">
				出金&nbsp;&nbsp;
			</div>
			<form action="chujin.html" onsubmit="return false;" method="post" class="form-horizontal actfrm">
				<div class="form-group">
					<label class="col-sm-2 control-label" style="color:red;font-weight:bold;font-size:15px;"></label>
					<div class="col-md-8">
						<span style="line-height:25px;font-size:14px;">美元：<span style="font-weight:bold;color:red" id="lbl_amount">0</span> &nbsp;&nbsp; 折合人民币：
						<span style="font-weight:bold;color:red" id="lbl_amount_cny">0</span>元
						</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">金额(人民币)<span class="required" aria-required="true">*</span></label>
					<div class="col-md-4">
						<input type="number" step="0.01" min="0.01" placeholder="请输入金额" required="required"  class="form-control required" name="amount" autocomplete="off">
					</div>
				</div><br>
				<div class="form-group" style="display: ;">
					<label class="col-sm-2 control-label" style="color:red;font-weight:bold;font-size:15px;">出金说明 :</label>
					<div class="col-md-8">
						<span style="line-height:25px;font-size:14px;color:red;">每笔出金三方支付将收取-元人民币手续费 </span>
					</div>
				</div>
				<div class="form-group">
					<div style="margin: 9px 0 0 158px;">
						<button type="submit" id="btn_sub" class="btn btn-primary">出金</button>
					</div>
				</div>
			</form>

		</div>
	</div>
</div>
{/block}
<!--自定义页面js-->
{block name="self_js"}
<script type="text/javascript">
			$("#btn_sub").click(
				function(){
					console.log({$user_account.account});
					if($("input[name='amount']").val()>{$user_account.account}){
						layer.alert("可用余额不足！");
						return false;
					}else if($("input[name='amount']").val()<0){
						layer.alert("数据格式错误！！");
						$("input[name='amount']").focus();
						return false;
					}
					$.ajax({
						type:"post",
						data:{
							name:null,
							amount:$("input[name='amount']").val()
						},
						url:"/index.php/withdrawal/post_withdraw",
						success:function(result){
							if(result['code'] == 1){
								layer.alert("提现申请已记录！我们会尽快处理");
								window.location.href = "/index.php/withdrawal/record"
							}else if(result['code'] == -1){
								console.log(result);
								layer.alert(result['msg']);
							}else{
								console.log(result);
							}
						},
						error:function(result){
							console.log(result);
						},
						async:true
					});
				}
			)
		</script>
{/block}